package managers

import (
	"myself/db/models"
	"myself/util"
)

type postingManager struct {
	BaseManager
}

var posting *postingManager
var oncePosting util.Once

func NewPostingManager() (*postingManager, error) {
	err := oncePosting.Do(func() error {
		if posting == nil {
			conn, err := InitDb()
			if err != nil {
				return err
			}
			posting = &postingManager{}
			posting.SetModel(&models.Posting{})
			posting.SetConn(conn)
		}
		return nil
	})
	return posting, err
}
